package com.company.笔试.完美的正数;// 本题为考试多行输入输出规范示例，无需提交，不计分。
import java.util.*;

public class Main {

    public static  final long MAX_NUM = 10000000000L;

    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int n = sc.nextInt();

        long  x,y,t=0;
//        for(int i = 1; i <= n; i++){
        for(int i = 1; i <= 2; i++){

//            x = sc.nextInt();
//            y = sc.nextInt();
            x=184968468L;
            y=7899898998L;
            int ans = 0;
            for(int j = 1;j<10;j++){
                long tmp = j;
                while(true){
                    if (tmp>MAX_NUM||tmp>y) break;
                    if(isGoodNum(tmp)){
                        if(tmp>=x) {
                            ans++;
                            System.out.println(tmp+"  "+ans);
                        }

                    }
                    tmp = tmp*10+j;




                }
            }
            System.out.println(ans);
        }

    }

    public static boolean isGoodNum(long args) {
        String str =  String.valueOf(args);
        char [] arr = str.toCharArray();
        char ch = arr[0];
        for(int ii=1;ii<arr.length;ii++){
            if(ch!=arr[ii]) return false;
            ch = arr[ii];
        }
        return true;

    }

}